<?php $this->load->view($config['site_template'].'/head');?>
<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="row">
            <div class="col-sm-12">

                <div class="ibox">
                    <!--
                    <div class="ibox-title">
                        <h5>所有列表</h5>

                        <div class="ibox-tools">
                            <a href="projects.html" class="btn btn-primary btn-xs">创建新项目</a>
                        </div>

                    </div>
                    -->
                    <div class="ibox-content">

                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-1">
                                <button type="button" id="loading-example-btn" class="btn btn-white btn-sm"><i class="fa fa-refresh"></i> 刷新</button>
                            </div>
                            <div class="col-md-11">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入异常问题描述" class="input-sm form-control"> <span class="input-group-btn">
                                        <button type="button" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                        </div>

                        <div class="project-list">

                            <table class="table table-hover">
                                <tbody>
                                    <tr>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">序号</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">填写人</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">所在部门</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">填写时间</a>
                                        </td>

                                        <td class="project-title">
                                            <a href="javascript:void(0)">清理线别</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">振筛边缘是否有漏料</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">筛网是否破损</a>
                                        </td>

                                        <td class="project-title">
                                            <a href="javascript:void(0)">清理前振筛照片</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">清理后振筛照片</a>
                                        </td>

                                        <td class="project-title">
                                            <a href="javascript:void(0)">备注</a>
                                        </td>

                                        <td class="project-title" style="text-align: right;">
                                            <a href="javascript:void(0)">操作</a>
                                        </td>
                                    </tr>
                                    <?php foreach ($list as $value):?>
                                    <tr>
                                        
                                        <td class="project-status">
                                            <span class="label label-primary"><?=$value['lid']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['userName']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['userDeptName']?>
                                        </td>
                                        <td class="project">
                                            <?=date('Y-m-d H:i:s',$value['createTime'])?>
                                        </td>
                                        <td class="project">
                                            <?=$value['clearLineName']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['isLouLiao'] == 0 ? "没有漏料" : "有漏料"?>
                                        </td>
                                        <td class="project">
                                            <?=$value['isPoSun'] == 0 ? "正常" : "破损"?>
                                        </td>
                                        <td class="social-avatar">
                                            <a href="javascript:void(0)">
                                                <?php if(strlen($value['beforeImgSrc'])  > 0):?>
                                                <img alt="image" class="img" id="beforeImgSrc" src="<?=  base_url().$value['beforeImgSrc']?>">
                                                <?php endif;?>
                                            </a>
                                        </td>
                                        <td class="social-avatar">
                                            <a href="javascript:void(0)">
                                                <?php if(strlen($value['afterImgSrc'])  > 0):?>
                                                    <img alt="image" class="img" id="afterImgSrc" src="<?=  base_url().$value['afterImgSrc']?>">
                                                <?php endif;?>
                                            </a>
                                        </td>
                                        <td class="project">
                                            <?=$value['remark']?>
                                        </td>
                                        <td class="project-actions">
                                            <a href="javascript:void(0)" class="btn btn-white btn-sm showOrder"><input type="hidden" name="id" value="<?=$value['id']?>"><i class="fa fa-folder"></i> 查看 </a>
                                            <!--<a href="projects.html#" class="btn btn-white btn-sm"><i class="fa fa-pencil"></i> 编辑 </a>-->
                                        </td>
                                       
                                    </tr>
                                    <?php endforeach;?>
                                    </tbody>
                                    
                                    
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <script>
       $(document).ready(function() {
            $("#loading-example-btn").click(function() {
                btn = $(this);
                simpleLoad(btn, true);
                simpleLoad(btn, false)
            })
            $('.img').click(function(){
                var src = $(this).attr("src")
                var id = $(this).attr("id");
                var showText;
                if(id == "beforeImgSrc"){
                    showText = "清理前筛振照片";
                }else if(id == "afterImgSrc"){
                    showText = "清理后筛振照片";
                }
                $(".showText").text(showText);
                $("#thumb").attr('src',src);
                $(".showThumb").click();
            });
            $(".showOrder").click(function(){
                var id = $(this).find("[name=id]").val();
                $.ajax({
                    type:"GET",
                    url:'<?=base_url("baoZhuang_ZSClear/getSingleContent?id=")?>'+id,
                    dataType: "json",
                    success:function(data){
                        if(data.userName.length > 0){
                            $("#userName").html(data.userName);
                        }else{
                            $("#userName").html("无数据");
                        }
                        if(data.userDeptName.length > 0){
                            $("#userDeptName").html(data.userDeptName);
                        }else{
                            $("#userDeptName").html("无数据");
                        }
                        if(data.createTime.length > 0){
                            $("#createTime").html(data.createTime);
                        }else{
                            $("#createTime").html("无数据");
                        }
                        if(data.clearLineName.length > 0){
                            $("#clearLineName").html(data.clearLineName);
                        }else{
                            $("#clearLineName").html("无数据");
                        }
                        if(data.isLouLiao.length > 0){
                            var louLiao;
                            if(data.isLouLiao == 0){
                                louLiao = "没有漏料";
                            }else if(data.isLouLiao == 1){
                                louLiao = "有漏料";
                            }
                            $("#isLouLiao").html(louLiao);
                        }else{
                            $("#isLouLiao").html("无数据");
                        }
                        if(data.isPoSun.length > 0){
                            var poSun;
                            if(data.isPoSun == 0){
                                poSun = "正常";
                            }else if(data.isPoSun == 1){
                                poSun = "破损";
                            }
                            $("#isPoSun").html(poSun);
                        }else{
                            $("#isPoSun").html("无数据");
                        }
                        if(data.createTime.length > 0){
                            $("#createTime").html(data.createTime);
                        }else{
                            $("#createTime").html("无数据");
                        }
                        if(data.beforeImgSrc.length > 0){
                            $("#beforeImgSrcShow").html('<img src="<?=  base_url()?>'+data.beforeImgSrc+'" class="img-responsive" alt="Cinque Terre">');
                        }else{
                            $("#beforeImgSrcShow").html("无数据");
                        }
                        if(data.afterImgSrc.length > 0){
                            $("#afterImgSrcShow").html('<img src="<?=  base_url()?>'+data.afterImgSrc+'" class="img-responsive" alt="Cinque Terre">');
                        }else{
                            $("#afterImgSrcShow").html("无数据");
                        }
                        if(data.remark.length > 0){
                            $("#remark").html(data.remark);
                        }else{
                            $("#remark").html("无数据");
                        }
                        /*
                        if(data.thumb.length > 0){
                            $("#thumb_show").html('<img src="<?=  base_url()?>'+data.thumb+'" class="img-responsive" alt="Cinque Terre">');
                        }else{
                            $("#thumb_show").html('');
                        }
                        if(data.title.length > 0){
                            $("#title").html(data.title);
                        }else{
                            $("#title").html("");
                        }
                        if(data.description.length > 0){
                            $("#description").html(data.description);
                        }else{
                            $("#description").html("");
                        }
                        if(data.content.length > 0){
                            $("#content").html(data.content);
                        }else{
                            $("#content").html("");
                        }
                        */
                        $(".showAbnormalQas").click();
                    }
                    
                })
            })
        });
        function simpleLoad(btn, state) {
            if (state) {
                btn.children().addClass("fa-spin");
                btn.contents().last().replaceWith(" Loading")
            } else {
                setTimeout(function() {
                    btn.children().removeClass("fa-spin");
                    btn.contents().last().replaceWith(" Refresh")
                },
                2000)
            }
        };
    
        $(function () { $('#imgShow').modal('hide')});
        $(function () { $('#imgShow').on('hide.bs.modal', function () {
           //alert('嘿，我听说您喜欢模态框...');
           })
        });
    </script>
    
    </body>
    <!--异常问题截图展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showThumb" style="display: none" data-toggle="modal" data-target="#imgShow">
            演示图片模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="imgShow" tabindex="-1" role="dialog" aria-labelledby="imgShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="imgShowLabel">
                                        <div class="showText">异常问题截图</div>
                                    </h4>
                            </div>
                            <div class="modal-body">
                                    <img id="thumb" src="" class="img-responsive" alt="Cinque Terre"> 
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    
    <!--异常问题详细内容展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showAbnormalQas" style="display: none" data-toggle="modal" data-target="#AbnormalQasShow">
            异常问题详细模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="AbnormalQasShow" tabindex="-1" role="dialog" aria-labelledby="AbnormalQasShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="AbnormalQasShowLabel">
                                        包装-振筛网清理记录
                                    </h4>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">填写人</label>
                                    <div id="userName" class="col-sm-9 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">所在部门</label>
                                    <div id="userDeptName" class="col-sm-9 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">填写时间</label>
                                    <div id="createTime" class="col-sm-9 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">清理线别</label>
                                    <div id="clearLineName" class="col-sm-9 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">筛网边缘是否漏料</label>
                                    <div id="isLouLiao" class="col-sm-9 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">筛网是否破损</label>
                                    <div id="isPoSun" class="col-sm-9 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">清理前振筛照片</label>
                                    <div id="beforeImgSrcShow" class="col-sm-9 well well-sm">11</div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">清理后振筛照片</label>
                                    <div id="afterImgSrcShow" class="col-sm-9 well well-sm">11</div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label well well-sm">备注</label>
                                    <div id="remark" class="col-sm-9 well well-sm"></div>

                                </div>
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
<?php $this->load->view($config['site_template'].'/foot');?>